<template>
	<video id="commonVideoView" :src="videoInfo" @fullscreenchange="fullscreenchange"></video>
</template>

<script>
	export default {
		data() {
			return {
				formSupport: true,
				videoInfo: '',
			}
		},
		onReady() {
			this.videoContext = uni.createVideoContext('commonVideoView')
		},
		onLoad() {
			//页面传值
			const eventChannel = this.getOpenerEventChannel();
			eventChannel.on('videoInfo', (data) => {
				this.videoInfo = data.data
			})
			this.requestCenter.getSystemConfig().then(res => {
				this.formSupport = res.formSupport

				if (this.formSupport) {
					this.videoContext.requestFullScreen({
						direction: 0
					})
					this.videoContext.play()
				}
			})
		},
		methods: {
			//全屏变化
			fullscreenchange(event) {
				let fullScreen = event.detail.fullScreen
				if (!fullScreen) {
					uni.navigateBack()
				}
			}
		}
	}
</script>

<style scoped lang="less">
	
</style>